package com.pcg.posgasstation.model.network.entity;

import com.pcg.posgasstation.event.ExitLoginEvent;

import org.greenrobot.eventbus.EventBus;

public class BaseEntity<T> {

    private int code;
    private String msg;
    private T data;
    private String url;
    private int count;

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public int getCount() {
        return count;
    }

    public void setCount(int count) {
        this.count = count;
    }

    public boolean isSuccess() {
        if (code == 0) {
            return true;
        } else if (code == -1){
            EventBus.getDefault().post(new ExitLoginEvent());
        }
        return false;
    }

}
